from apps.work.models import All_Kq_Infos, All_Kq_Orders, Kq_Extend_infos, Kq_Maintain_infos, Kq_Price_infos, \
    Kq_All_Pumps, Kq_All_Projects
from apps.vadmin.op_drf.serializers import CustomModelSerializer


# ================================================= #
# ************** 客户库 序列化器  ************** #
# ================================================= #
class WorkSerializer(CustomModelSerializer):
    """
    所有工作 简单序列化器
    """

    class Meta:
        model = All_Kq_Infos
        fields = '__all__'


class WorkCreateUpdateSerializer(CustomModelSerializer):
    """
    我的工作 创建/更新时的列化器
    """

    # 此处可写定制的 创建/更新 内容
    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = All_Kq_Infos
        fields = '__all__'


class ExportWorkSerializer(CustomModelSerializer):
    """
    导出 凯泉客户库 简单序列化器
    """

    class Meta:
        model = All_Kq_Infos
        fields = ('id', 'compName', 'compOwner', 'regCap', 'realCap', 'foundDay', 'opStatus', 'province', 'city',
                  'district', 'street', 'compType', 'industry', 'oldName', 'empNum', 'phone', 'otherPhone', 'address',
                  'url', 'email', 'businessScope')


# ================================================= #
# ************** 订单中心 序列化器  ************** #
# ================================================= #
class OrderSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = All_Kq_Orders
        fields = '__all__'


class OrderCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = All_Kq_Orders
        fields = '__all__'


class ExportOrderSerializer(CustomModelSerializer):
    """
    导出 我的工作 简单序列化器
    """

    class Meta:
        model = All_Kq_Orders
        fields = ('id', 'orderId', 'compName', 'projectName', 'products', 'dealNum', 'orderDate',
                  'orderType', 'collaborator', 'isEmployed', 'sex', 'position', 'maxDepartment',
                  'department')


# ================================================= #
# ************** Kq拓展信息 序列化器  ************** #
# ================================================= #
class KqExtendInfoSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = Kq_Extend_infos
        fields = '__all__'


class KqExtendInfoCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = Kq_Extend_infos
        fields = '__all__'


# ================================================= #
# ************** 维护 序列化器  ************** #
# ================================================= #
class KqMaintainSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = Kq_Maintain_infos
        fields = '__all__'


class KqMaintainCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = Kq_Maintain_infos
        fields = '__all__'


class ExportMaintainSerializer(CustomModelSerializer):
    """
    导出 我的工作 简单序列化器
    """

    class Meta:
        model = Kq_Maintain_infos
        fields = ('create_datetime', 'compName', 'name', 'position', 'phone', 'mainBusiness', 'YearUsage',
                  'classify', 'extendDesc')


# ================================================= #
# ************** 报价 序列化器  ************** #
# ================================================= #
class KqPriceSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = Kq_Price_infos
        fields = '__all__'


class KqPriceCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = Kq_Price_infos
        fields = '__all__'


# ================================================= #
# ************** pumps 序列化器  ************** #
# ================================================= #
class KqPumpsSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = Kq_All_Pumps
        fields = '__all__'


class KqPumpsCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = Kq_All_Pumps
        fields = '__all__'


class ExportKqPumpsSerializer(CustomModelSerializer):
    """
    导出 我的工作 简单序列化器
    """

    class Meta:
        model = Kq_All_Pumps
        fields = ('id', 'kind', 'type', 'flow', 'height', 'power', 'rev',
                  'calibre', 'compType', 'description')


# ================================================= #
# ************** Kq项目 序列化器  ************** #
# ================================================= #
class KqAllProjectsSerializer(CustomModelSerializer):
    """
    简单订单序列化器
    """

    class Meta:
        model = Kq_All_Projects
        fields = '__all__'


class KqAllProjectCreateUpdateSerializer(CustomModelSerializer):
    """
    订单 创建/更新时的列化器
    """

    def validate(self, attrs: dict):
        return super().validate(attrs)

    class Meta:
        model = Kq_All_Projects
        fields = '__all__'
